<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>首页-AddressBook</title>
    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link th:href="@{/css/dashboard.css}" rel="stylesheet">

    <link rel="stylesheet" th:href="@{css/bootstrap-theme.min.css}">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
    <!-- Latest compiled and minified Locales -->
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/locale/bootstrap-table-zh-CN.min.js"></script>

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/hint.css/2.5.1/hint.min.css">


    <script>
        window.dataLayer = window.dataLayer || []
        function gtag() {window.dataLayer.push(arguments)}
        gtag('js', new Date())
        gtag('config', 'UA-132747866-1')
    </script>
    <style type="text/css">
        /* Chart.js */

        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
    </style>
</head>

<body>

<!--顶部导航栏-->
<div th:replace="~{commons/commons::topbar}"></div>

<div class="container-fluid">
    <div class="row">
        <!--侧边栏-->
        <div th:replace="~{commons/commons::sidebar(active='main.html')}" ></div>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2>
            <!--<a class="btn btn-lg btn-success" th:href="@{/user/addCategory}">新建分组</a>-->
                <button  type="button" class="btn btn-lg btn-success" data-toggle="modal" data-target="#exampleModal">新建分组</button>
                <div class="modal" tabindex="-1" role="dialog" id="exampleModal" >
                    <div class="modal-dialog modal-dialog-centered" role="document">
                        <div class="modal-content">
                            <div class="modal-header" style="height:50px">
                                <h3 class="modal-title">新建分组</h3>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                </button>
                            </div>
                            <form class="form-signin" th:action="@{/user/addCategory}" method="post" >
                            <div class="modal-body" style="height:100px">
                                <input type="text" id="categoryName" name="categoryName" class="form-control" required="required" placeholder="分组名称">
                            </div>
                                <div class="modal-footer" style="height:60px">
                                    <button type="submit" class="btn  btn-lg btn-primary">保存</button>
                                    <button type="button" class="btn  btn-lg btn-secondary" data-dismiss="modal" style="width:50px">关闭</button>

                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <button  type="button" class="btn btn-lg btn-danger" data-toggle="modal" data-target="#exampleModal2">删除分组</button>
                <div class="modal" tabindex="-1" role="dialog" id="exampleModal2" >
                    <div class="modal-dialog modal-dialog-centered" role="document">
                        <div class="modal-content">
                            <div class="modal-header" style="height:50px">
                                <h3 class="modal-title">新建分组</h3>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                </button>
                            </div>
                            <form class="form-signin" th:action="@{/user/deleteCategory}" method="post" >
                                <div class="modal-body" style="height:100px">
                                   <!-- <input type="text" id="categoryId" name="categoryName" class="form-control" required="required" placeholder="分组名称">-->
                                    <label>分组选择</label>
                                    <select class="form-control" name="categoryId">
                                        <option th:each="category:${categoryList}" th:text="${category.getCategoryName()}" th:value="${category.getCategoryId()}">
                                        </option>
                                    </select>
                                </div>
                                <div class="modal-footer" style="height:60px">
                                    <button type="submit" class="btn  btn-lg btn-secondary">删除</button>
                                    <button type="button" class="btn  btn-lg btn-warning" data-dismiss="modal" style="width:50px">关闭</button>

                                </div>
                            </form>
                        </div>
                    </div>
                </div>

            </h2>
            <div class="accordion" id="accordionExample"  >
                <div class="card" th:each="category:${categoryList}">
                    <div class="card-header" th:id="heading+${category.getCategoryId()}">
                        <h2 class="mb-0" >
                            <button th:name="${category.getCategoryName()}" class="glyphicon glyphicon-menu-right btn btn-link btn-block text-left" type="button" data-toggle="collapse" th:attr="data-target='#collapse'+${category.getCategoryId()}" aria-expanded="true" th:aria-controls="'collapse'+${category.getCategoryId()}">
                                [[${category.getCategoryName()}]]
                            </button>
                        </h2>

                    </div>


                    <div th:id="${'collapse'+category.getCategoryId()}" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class=" table table-sm table-hover"
                                       data-toggle="table"
                                       data-pagination="false"
                                       data-pagination-loop="false"
                                       data-search="true"
                                       data-show-pagination-switch="true"
                                       data-show-columns="true"
                                       data-page-number="1"
                                       data-page-size="5"
                                       data-page-list="[5,10,25]"
                                       data-click-to-select="true"
                                       data-striped="true">
                                    <thead class="thead-dark">
                                    <tr>
                                        <!-- <th>personId</th>-->

                                        <th>Icon</th>
                                        <th>姓名</th>
                                        <th>手机</th>
                                        <th>电话</th>
                                        <th>微信</th>
                                        <th>QQ</th>
                                        <th>E-mail</th>
                                        <th>工作单位</th>
                                        <th>家庭住址</th>
                                        <th>邮编</th>
                                        <th>备注</th>
                                        <th>生日</th>
                                        <!--<th>分组</th>-->
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="person:${personInfoList}" th:if="${person.getCategoryId()}==${category.getCategoryId()}">
                                        <!-- <td th:text="${person.getPersonId()}"></td>-->
                                        <td th:icon="${person.getPersonIcon()}" width="30" height="30" ></td>
                                        <td th:text="${person.getPersonName()}"></td>
                                        <td th:text="${person.getPersonPhone1()}"></td>
                                        <td th:text="${person.getPersonPhone2()}"></td>
                                        <td th:text="${person.getPersonWechat()}"></td>
                                        <td th:text="${person.getPersonQq()}"></td>
                                        <td th:text="${person.getPersonMail()}"></td>
                                        <td th:text="${person.getPersonCompany()}"></td>
                                        <td th:text="${person.getPersonAddress()}"></td>
                                        <td th:text="${person.getPersonPostcode()}"></td>
                                        <td th:text="${person.getPersonRemark()}"></td>
                                        <td th:text="${#dates.format(person.getPersonBirthday(),'yyyy-MM-dd')}"></td>
                                       <!-- <td th:text="${categoryList.get(person.getCategoryId()).getCategoryName()}"></td>-->
                                        <td>
                                            <!--<a class="btn btn-sm btn-primary" th:href="@{/user/toChangePerson?personId=}+${person.getPersonId()}">编辑</a>-->
                                            <div class="dropdown">
                                                <a class="btn btn-sm btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
                                                    移动至
                                                </a>

                                                <div class="dropdown-menu" aria-labelledby="dropdownMenuLink" >
                                                    <a class="dropdown-item"  th:each="category2:${categoryList}" th:href="@{/user/movePerson(personId=${person.getPersonId()},categoryId=${category2.getCategoryId()})}">[[${category2.getCategoryName()}]]</a>
                                                </div>

                                                <a class="btn btn-sm btn-danger" th:href="@{/user/toDeleteCategoryPerson?personId=}+${person.getPersonId()}" onClick="return confirm('确定要从该分组中删除?,删除后将移动至未分组中.')">删除</a>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </main>
    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" ></script>
<script type="text/javascript" src="asserts/js/popper.min.js" ></script>
<script type="text/javascript" src="asserts/js/bootstrap.min.js" ></script>

<!-- Icons -->
<script type="text/javascript" src="asserts/js/feather.min.js" ></script>
<script>
    feather.replace()
</script>

<!-- Graphs -->
<script type="text/javascript" src="asserts/js/Chart.min.js" ></script>
<script>
    var ctx = document.getElementById("myChart");
    var myChart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
            datasets: [{
                data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
                lineTension: 0,
                backgroundColor: 'transparent',
                borderColor: '#007bff',
                borderWidth: 4,
                pointBackgroundColor: '#007bff'
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero: false
                    }
                }]
            },
            legend: {
                display: false,
            }
        }
    });
</script>


</body>

</html>
